import { createRouter, createWebHashHistory } from "vue-router";

//  import HelloWord from '../components/HelloWorld.vue'
// 引入自己写的layout
import Layout from "../layout/index.vue";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/", //根目录路由为/
      component: Layout, //指定使用Layout组件布局
      redirect: "/home", //重定向至/home页面
      children: [
        {
          //子菜单信息
          path: "/home", //路径
          name: "home",
          component: () => import("../views/home.vue"), //指定组件
          meta: { title: "首页", access: 0, affix: true },
        },
      ],
    },
    {
      path: "/about",
      component: () => import("../views/about.vue"),
    },
    {
      path: "/login",
      component: () => import("../views/login.vue"),
    },
    {
      path: "/register",
      component: () => import("../views/register.vue"),
    },
  ],
});

export default router;
